package org.itstack.demo.design;

import org.itstack.demo.design.cuisine.ICuisine;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.ArrayList;
import java.util.List;

/**
 * @Author: fanYuLe
 * @CreateTime: 2023-12-26  14:55
 * @Description:
 */
public class XiaoEr {
    private Logger logger = LoggerFactory.getLogger(XiaoEr.class);
    private List<ICuisine> cuisineList = new ArrayList<>();

    public void order (ICuisine cuisine) {
        cuisineList.add(cuisine);
    }

    public synchronized void placeOrder(){
        for (ICuisine cuisine : cuisineList) {
            cuisine.cook();
        }
        cuisineList.clear();
    }
}
